﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using EDiamondModel;
public partial class UControls_UCMonMoiBottom : System.Web.UI.UserControl
{
    public string dsLoaiMoi()
    {
        using (EDiamondEntities1 db = new EDiamondEntities1())
        {
            var query = db.SanPhams.OrderByDescending(x => x.NgayCapNhat).Take(10);
            StringBuilder stb = new StringBuilder();
            stb.AppendLine("<ul id='mycarousel' class='jcarousel jcarousel-skin-tango'>");
            foreach (SanPham spham in query)
                stb.AppendLine("<li><a href=../Pages/SanPhamCT.aspx?idSP=" + spham.SanPhamID
                    + "><img style='border:0px solid white;' src='../Photos/SanPham/"
                    + spham.Hinh + "' width='160px' height='70px' alt='' title='"
                    + spham.TenSanPham + "' /></a></li>");
            stb.AppendLine("</ul>");
            return stb.ToString();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            dsloaimoi.Text = dsLoaiMoi();
    }
}